<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="manifest" href="manifest.json"/>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0, viewport-fit=cover"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <script>
      if (!window.Promise) {
        document.writeln('<script src="https://appx/es6-promise.min.js"' + ' >' + '<' + '/' + 'script>');
      }
    </script>
    <script>
      if (self.ES6Promise) {
        self.ES6Promise.polyfill();
      }
    </script>
    <link rel="stylesheet" href="https://appx/af-appx.min.css"/>
    <style>
        body {
            background: transparent;
        }
    </style>
</head>
<body>
<div id="__react-content"></div>
<script src="https://appx/af-appx.min.js" ></script>
<script src="/index.js"></script>
<script>
  (function () {
    function onReady(callback) {
      document.addEventListener('AlipayJSBridgeReady', function () {

        (function () {
          var _g = window,
            AlipayJSBridge = _g.AlipayJSBridge;

          var doc = document;
          var html = '\n<img id="appxRestart"\n width="40"\n height="40"\n src="https://gw.alipayobjects.com/zos/rmsportal/qYxTkMOBXFZqZHMgtIiF.jpg"/>\n\n';
          var div = document.createElement('div');
          div.style.position = 'fixed';
          div.style.zIndex = '99999';
          div.style.top = (window.innerHeight - 60) + 'px';
          div.style.left = (window.innerWidth - 60) + 'px';
          div.innerHTML = html;
          document.body.appendChild(div);

          var restart = function restart(e) {
            if (!e || (e.metaKey || e.ctrlKey) && e.key === 'r') {
              AlipayJSBridge.call('exitApp');
              var keys = ['url', 'appId', 'scheme', 'enableWK', 'launchParamsTag', 'debug', 'page', 'enableJSC', 'enableTabBar', 'tabBarJson', 'appConfigJson', 'query'];
              var startupParams = AlipayJSBridge.startupParams;

              var s = [];
              keys.forEach(function (key) {
                if (key in startupParams) {
                  var v = startupParams[key];
                  if (typeof v === 'boolean') {
                    v = v ? 'YES' : 'NO';
                  }
                  s.push(key + '=' + encodeURIComponent(v));
                }
              });
              var url = startupParams.scheme + '://platformapi/startapp?' + s.join('&');
              AlipayJSBridge.call('openInBrowser', { url: url });
            }
          };
          doc.getElementById('appxRestart').onclick = function () {
            restart();
          };
          var startX, startY;
          var startLeft, startTop;
          doc.getElementById('appxRestart').ontouchstart = function (e) {
            startX = e.touches[0].pageX;
            startY = e.touches[0].pageY;
            startLeft = parseInt(div.style.left);
            startTop = parseInt(div.style.top);
          };
          doc.getElementById('appxRestart').ontouchmove = function (e) {
            e.preventDefault();
            var endX = e.touches[0].pageX;
            var endY = e.touches[0].pageY;
            div.style.left = (startLeft + endX - startX) + 'px';
            div.style.top = (startTop + endY - startY) + 'px';
          };
          doc.addEventListener('keydown', restart);
        })();

        callback({
          bridge: window.AlipayJSBridge
        });
      });
    }

    window.bootstrapApp({
      worker: '/index.worker.js',
      onReady: onReady
    });
  })();
</script>
</body>
</html>
